/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.loja.model.entity.transacao;

import javax.persistence.CascadeType;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import br.com.loja.model.entity.compra.Compra;

/**
 *
 * @author David Luiz
 */
@MappedSuperclass
public abstract class PagamentoCompra extends Debito {

    @ManyToOne(cascade = CascadeType.ALL)
    private Compra compra;

    public PagamentoCompra() {
        super();
    }

    protected PagamentoCompra(Compra compra) {
        super();

        if (compra == null) {
            throw new IllegalArgumentException("Compra Invalida");
        }

        this.compra = compra;
    }

    /**
     * @return the compra
     */
    public Compra getCompra() {
        return compra;
    }

    /**
     * @param compra the compra to set
     */
    public void setCompra(Compra compra) {
        this.compra = compra;
    }

}
